import axios from '@/libs/api.request'

// ============= 运动计划相关API =============

// 获取运动计划列表
export const getExercisePlans = (params = {}) => {
  return axios.request({
    url: 'plan/exercise',
    method: 'get',
    params
  })
}

// 获取单个运动计划详情
export const getExercisePlanDetail = (planId) => {
  return axios.request({
    url: `plan/exercise/${planId}`,
    method: 'get'
  })
}

// 创建运动计划
export const createExercisePlan = (data) => {
  return axios.request({
    url: 'plan/exercise',
    data,
    method: 'post'
  })
}

// 更新运动计划
export const updateExercisePlan = (planId, data) => {
  return axios.request({
    url: `plan/exercise/${planId}`,
    data,
    method: 'put'
  })
}

// 删除运动计划
export const deleteExercisePlan = (planId) => {
  return axios.request({
    url: `plan/exercise/${planId}`,
    method: 'delete'
  })
}

// ============= 餐饮计划相关API =============

// 获取餐饮计划列表
export const getMealPlans = (params = {}) => {
  return axios.request({
    url: 'plan/meal',
    method: 'get',
    params
  })
}

// 获取单个餐饮计划详情
export const getMealPlanDetail = (planId) => {
  return axios.request({
    url: `plan/meal/${planId}`,
    method: 'get'
  })
}

// 创建餐饮计划
export const createMealPlan = (data) => {
  return axios.request({
    url: 'plan/meal',
    data,
    method: 'post'
  })
}

// 更新餐饮计划
export const updateMealPlan = (planId, data) => {
  return axios.request({
    url: `plan/meal/${planId}`,
    data,
    method: 'put'
  })
}

// 删除餐饮计划
export const deleteMealPlan = (planId) => {
  return axios.request({
    url: `plan/meal/${planId}`,
    method: 'delete'
  })
}

// 获取每日三餐建议
export const getDailyMealSuggestion = (date) => {
  return axios.request({
    url: 'plan/meal/suggestion',
    method: 'get',
    params: { date }
  })
}
